{extend name='admin@main'}

{block name="button"}
{if auth("add")}
<button data-open="{:url("add")}" data-title="发布新闻" class="layui-btn layui-btn-sm layui-btn-warm">发布公告</button>
{/if}

{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='notice/index_search'}
    <table class="layui-table margin-top-10" lay-skin="switch" >
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>公告标题</th>
            <!--<th class='text-left nowrap'>公告编号</th>-->
            <th class='text-left nowrap'>公告类型</th>			
			<th class='text-left nowrap'>发布人/部门</th>
            
            <th class='text-left nowrap'>发布时间</th>
			<th class='text-center nowrap'>过期时间</th>
            <th class='text-left nowrap'></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class='list-table-sort-td'>
                <label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.id}" class="list-sort-input"></label>
            </td>
            <td class='text-left nowrap'><a data-dbclick data-open="{:url("edit")}?id={$vo.id}">{$vo.title|default=''}</a></td>
            <!-- <td class='text-left nowrap'>{$vo.docno|default='-'}</td> -->
            <td class='text-left nowrap'>
			{eq name='vo.gonggaoleixing' value='0'}<span class="color-red">公告</span>{/eq}
			{eq name='vo.gonggaoleixing' value='1'}<span class="color-green">通知</span>{/eq}
			{eq name='vo.gonggaoleixing' value='2'}<span class="color-blue">会议</span>{/eq}
			</td>
			<td class='text-left nowrap'>{$vo.docauthor|default='-'}/{$vo.docdept|default='-'}</td>
			
			<!---
            <td class='text-center nowrap'>
                {eq name='vo.status' value='0'}<span class="color-red">已撤回</span>{/eq}
                {eq name='vo.status' value='1'}
				
				
				{if $vo.flowcount ==1}
				<span class="layui-badge">正在流转</span>
				{else}
				<span class="color-green">正在流转</span>
				{/if}
				
				{/eq}
                {eq name='vo.status' value='2'}<span class="color-desc">已经完成</span>{/eq}
            </td>
			-->
			
            <td class='text-left nowrap'>
                {$vo.create_at|format_datetime='Y-m-d'}
            </td>
            <td class='text-left nowrap'>
                {$vo.docenddate|format_datetime='Y-m-d'}
            </td>
			
			
            <td class='text-left nowrap'>

                {if auth("printdoc")  }
                <a target="new" class="layui-btn layui-btn-sm" data-title="打  印" href='{:url("printdoc")}?id={$vo.id}'>打  印</a>
                {/if}

                {if auth("state") and $vo.status eq 2 and $vo.docauthor eq session('admin_user.nickname')}
                <a class="layui-btn layui-btn-sm layui-btn-danger" confirm="确定要打印吗？" href="{:url('printdoc')}?id={$vo.id}" target="new" data-value="id#{$vo.id}" data-csrf="{:systoken('state')}">打  印</a>
                {/if}

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
